package com.imooc.study.imoocstudy.mongodb.controller;

import com.imooc.study.imoocstudy.mongodb.entity.Customer;
import com.imooc.study.imoocstudy.mongodb.service.CustomerService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class MongoController {
    @Resource
    private CustomerService service;

    @ResponseBody
    @RequestMapping("mongoTest")
    public String mongoTest(){

        service.save(new Customer("Alice", "Smith"));
        service.save(new Customer("Bob", "Smith"));

        return "ok";
    }

}
